fix: dessin suit le curseur / stylet (S Pen Samsung)#6
Merged
Conversation
_toCanvasPos was using context.findRenderObject() which returns the RenderBox of the entire InkCanvas widget including the toolbar (52px). All drawn points were offset by the toolbar height, so strokes never matched the cursor/stylus position. Fix: use e.localPosition directly from the Listener event, which is already in the canvas area coordinate space (below the toolbar). Also: - Add PointerDeviceKind.invertedStylus (Samsung S Pen eraser end) - Guard onPointerMove to skip if no stroke is in progress https://claude.ai/code/session_01DrMeeXsyuHucgvtcwtJoLN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problème
Le tracé dans le mode Draw ne suivait pas le curseur/stylet — les traits étaient décalés de ~52px vers le bas.
Cause
_toCanvasPosutilisaitcontext.findRenderObject()qui retourne la RenderBox du widgetInkCanvasentier, toolbar incluse (52px de hauteur). Toutes les coordonnées étaient donc décalées de la hauteur de la toolbar.Fix
Utiliser
e.localPositiondirectement depuis l'événementListener, qui est déjà dans le système de coordonnées de la zone canvas (sous la toolbar). Plus besoin de chercher la RenderBox manuellement.Améliorations bonus
PointerDeviceKind.invertedStylus→ le bout gomme du Samsung S Pen fonctionne maintenantonPointerMoveignore les événements si aucun trait n'est en cours (évite des points parasites)